<?php
class CheckingController extends AppController{
     public function beforeFilter() {
        parent::beforeFilter();
        $this->loadModel('Camera');
        $this->set('title_for_layout', "checking");
        $this->menu_active = 'checking';
    }
    public function index(){
        $cmr_status=false;
        $cameras = $this->Camera->getAllCamera($this->request->data);
        /*
        foreach ($cameras as $key => $value) {
            $url = 'http://'.$value["Camera"]["UniIp"].':'.$value["Camera"]["HttpPort"].'/cgi-bin/encoder?USER='.$value["Camera"]["UserName"].'&PWD='.$value["Camera"]["Password"].'&GET_STREAM';
            //var_dump($url);
            $cmr_status=  Common::pingcammera($url);
            if($cmr_status==true){
               $cameras[$key]["Camera"]['status']='on';
            }else{
                $cameras[$key]["Camera"]['status']='off';
            }
            
            
        }
        */
        $this->set('cameras', $cameras);
    }
}